<script setup>
import { ref, watch } from 'vue';

const props = defineProps(['usageVariousAssociationsData']);

const config = ref({
  header: [
    '归属分行',
    '协会名称',
    '协会积分',
    '协会人数',
    '活动数量',
    '论坛发布量',
  ],
  data: [],
  align: ['center', 'center', 'center', 'center', 'center', 'center', 'center'],
  headerBGColor: '#0f1325',
  columnWidth: [80],
  index: true,
  headerHeight: 35,
  rowNum: 8,
});


// 监听数据变化
watch(
  () => props.usageVariousAssociationsData,
  (newVal) => {
    if (newVal) {
      config.value.data = newVal.map((item) => [
        item.belongBranch || '-',
        item.orgName || '-',
        item.orgIntegral?.toString() || '0',
        item.orgNumber?.toString() || '0',
        item.activityNumber?.toString() || '0',
        item.forumNumber?.toString() || '0',
      ]);
    }
  },
  { immediate: true },
);

</script>

<template>
  <div class="pl-4 pr-4">
    <dv-scroll-board :config="config" style="width: 100%; height:250px" />
  </div>
</template>
